package com.cooper.dao.item;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.Insert;
import net.paoding.rose.jade.annotation.ReturnGeneratedKeys;
import net.paoding.rose.jade.annotation.SQL;

import com.cooper.entity.ItemStatEntity;

@DAO
public interface ItemStatDAO {
	
	static final String TABLE_NAME = "d_item_stat";
	
	@ReturnGeneratedKeys
	@Insert(tableName=TABLE_NAME)
	Long saveEntity(ItemStatEntity itemStat) throws Exception;
	
	@SQL("update d_item_stat set like_num=like_num+1 where deleted='n' and item_id=:1 ")
	void like(Long itemId) throws Exception;
	
	@SQL("update d_item_stat set unlike_num=unlike_num+1 where deleted='n' and item_id=:1 ")
	void unlike(Long itemId) throws Exception;
	
	@SQL("update d_item_stat set sold_out=sold_out+1 where deleted='n' and item_id=:1 ")
	void soldOut(Long itemId) throws Exception;

}
